package cn.smbms.tools;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import cn.smbms.dao.BaseDao;

public class ConfigManager {

	private static ConfigManager configManegr;
	private static Properties properties;
	
	private ConfigManager(){
		String configFile = "database.properties";
		properties = new Properties();
		InputStream is=BaseDao.class.getClassLoader().getResourceAsStream(configFile);
		try {
			properties.load(is);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public static class ConfigManagerHelper{
		private static final ConfigManager INSTANCE = new ConfigManager();
	}
	
	
	public static  ConfigManager getInstance(){
		configManegr = ConfigManagerHelper.INSTANCE;
		return configManegr;
	}	
	
	public String getValue(String key){
		return properties.getProperty(key);
	}	
}
